using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Input.Touch;
using Microsoft.Xna.Framework.Media;


namespace MemoryGame
{
    public class StateCreadit : DEF
    {
        //


        public static void SendMessage(int type)
        {

            switch (type)
            {
                case MESSAGE_CTOR:

                    CREADIT_BACKGROUND_X = SCREEN_WIDTH / 20;
                    CREADIT_BACKGROUND_Y = SCREEN_HEIGHT / 6;
                    CREADIT_BACKGROUND_W = (int)SCREEN_WIDTH - 2 * SCREEN_WIDTH / 20;
                    CREADIT_BACKGROUND_H = (int)SCREEN_HEIGHT - 2 * SCREEN_HEIGHT / 6;

                    CREADIT_TITLE_X = SCREEN_WIDTH / 2;
                    CREADIT_TITLE_Y = CREADIT_BACKGROUND_Y + 3;
                    CREADIT_CONTENT_X = CREADIT_TITLE_X;
                    CREADIT_CONTENT_Y = 2 * CREADIT_TITLE_Y;

                    DEF.CREADIT_CONTENT_SPACE_H = (int)Game1.fontNormal.MeasureString("AJGG").Y;
                    DEF.CREADIT_CONTENT_Y = 3 * DEF.CREADIT_CONTENT_SPACE_H / 2 + DEF.CREADIT_TITLE_Y;
                    break;
                case MESSAGE_UPDATE:
                    if (InputState.misbackkeyPress || InputState.isTouchReleaseInRect(DEF.CREADIT_BACKGROUND_X + DEF.CREADIT_BACKGROUND_W - DEF.BUTTON_CANCEL_CONFIRM_W - 8, DEF.CREADIT_BACKGROUND_Y + 8, DEF.BUTTON_CANCEL_CONFIRM_W, DEF.BUTTON_CANCEL_CONFIRM_H))
                    {
                        SoundManager.playSound(SoundManager.SOUND_BACK);
                        Game1.changeState(Game1.STATE_MAINMENU, true, true);
                    }
                    break;
                case MESSAGE_PAINT:
                    Game1.spriteBatch.Draw(StateMainMenu.splashBitmap, new Vector2(0, 0), null, Color.White, 0f, new Vector2(0, 0), new Vector2(Game1.SCALE_X, Game1.SCALE_Y), SpriteEffects.None, 1);
                    Game1.spriteBatch.Draw(StateMainMenu.gameTitleBitmap, new Vector2((SCREEN_WIDTH - StateMainMenu.gameTitleBitmap.Width * Game1.SCALE_X) / 2, 0), null, Color.White, 0f, new Vector2(0, 0), new Vector2(Game1.SCALE_X, Game1.SCALE_Y), SpriteEffects.None, 1);
                    var t = new Texture2D(Game1.graphicsDevice, 1, 1);
                    t.SetData(new[] { Color.White });
                    Game1.spriteBatch.Draw(t, new Rectangle(CREADIT_BACKGROUND_X, CREADIT_BACKGROUND_Y, CREADIT_BACKGROUND_W, CREADIT_BACKGROUND_H), new Color(0, 0, 0, 200));
                    //draw text

                    Vector2 tempMeasure = Game1.fontBig.MeasureString("ABOUT");

                    Game1.spriteBatch.DrawString(Game1.fontBig, "ABOUT", new Vector2(DEF.CREADIT_TITLE_X - tempMeasure.X / 2, DEF.CREADIT_TITLE_Y), Color.Yellow);

                    tempMeasure = Game1.fontNormal.MeasureString("Game: Fish Rescue");
                    Game1.spriteBatch.DrawString(Game1.fontNormal, "Game: Fish Rescue", new Vector2(DEF.CREADIT_CONTENT_X - tempMeasure.X / 2, DEF.CREADIT_CONTENT_Y + DEF.CREADIT_CONTENT_SPACE_H), Color.Blue);

                    tempMeasure = Game1.fontNormal.MeasureString("Version: 1.0.0.0");
                    Game1.spriteBatch.DrawString(Game1.fontNormal, "Version: 1.0.0.0", new Vector2(DEF.CREADIT_CONTENT_X - tempMeasure.X / 2, DEF.CREADIT_CONTENT_Y + 2 * DEF.CREADIT_CONTENT_SPACE_H), Color.White);
                    tempMeasure = Game1.fontNormal.MeasureString("Support Contact");

                    Game1.spriteBatch.DrawString(Game1.fontNormal, "Support Contact", new Vector2(DEF.CREADIT_CONTENT_X - tempMeasure.X / 2, DEF.CREADIT_CONTENT_Y + 3 * DEF.CREADIT_CONTENT_SPACE_H), Color.Blue);

                    tempMeasure = Game1.fontNormal.MeasureString("n_m_hoang@hotmail.com");
                    Game1.spriteBatch.DrawString(Game1.fontNormal, "n_m_hoang@hotmail.com", new Vector2(DEF.CREADIT_CONTENT_X - tempMeasure.X / 2, DEF.CREADIT_CONTENT_Y + 4 * DEF.CREADIT_CONTENT_SPACE_H), Color.White);

                  //  tempMeasure = Game1.fontNormal.MeasureString("hoang_win85@hotmail.com");
                  //  Game1.spriteBatch.DrawString(Game1.fontNormal, "hoang_win85@hotmail.com", new Vector2(DEF.CREADIT_CONTENT_X - tempMeasure.X / 2, DEF.CREADIT_CONTENT_Y + 5 * DEF.CREADIT_CONTENT_SPACE_H), Color.White);

                    if (InputState.isTouchDrapInRect(DEF.CREADIT_BACKGROUND_X + DEF.CREADIT_BACKGROUND_W - DEF.BUTTON_CANCEL_CONFIRM_W, DEF.CREADIT_BACKGROUND_Y, DEF.BUTTON_CANCEL_CONFIRM_W, DEF.BUTTON_CANCEL_CONFIRM_H))
                        Game1.spriteBatch.Draw(texttureButtonMenu[DEF.FRAME_CANCEL_HIGHTLIGHT], new Vector2(DEF.CREADIT_BACKGROUND_X + DEF.CREADIT_BACKGROUND_W - DEF.BUTTON_CANCEL_CONFIRM_W, DEF.CREADIT_BACKGROUND_Y), null, Color.White, 0f, new Vector2(0, 0), new Vector2(Game1.SCALE_X, Game1.SCALE_Y), SpriteEffects.None, 1);
                    else
                        Game1.spriteBatch.Draw(texttureButtonMenu[DEF.FRAME_CANCEL_NORMAL], new Vector2(DEF.CREADIT_BACKGROUND_X + DEF.CREADIT_BACKGROUND_W - DEF.BUTTON_CANCEL_CONFIRM_W, DEF.CREADIT_BACKGROUND_Y), null, Color.White, 0f, new Vector2(0, 0), new Vector2(Game1.SCALE_X, Game1.SCALE_Y), SpriteEffects.None, 1);


                    break;
                case MESSAGE_DTOR:
                    break;
            }
        }
    }
}
